package com.springmvcch1.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class LoginController implements Controller{

	@Override
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String uname=request.getParameter("uname");
		String pwd=request.getParameter("pwd");
		ModelAndView mav=null;
		if (uname.equals("jyk")&&pwd.equals("jyk")) {
			mav=new ModelAndView("index.jsp");
			mav.addObject("mess", "登录成功！");
		}else {
			mav=new ModelAndView("login.jsp");
			mav.addObject("mess", "登录失败！");
		}
		return mav;
	}

}
